This code seems to work. It has to fudge around with save_pos restore_pos to get the highlight state to update immediately. The prev_word call is to get it to work when the cursor is already on the last line of the file. If you have performance problems, see def_highlight_symbols_max_matches and def_highlight_symbols_max_bufsize in the help file (use search). Alternatively, have a look at _UpdateContextHighlights and the call to _update_current_symbol to see how to force an immediate update without three calls to the render function. There might be some easier way to force an immediate update but I couldn't find it.
Graeme
#include "slick.sh"
_command toggle_highlight_matching_symbols() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
_str ext = _Filename2LangId(_mdi.p_child.p_buf_name);
_SetLanguageOption(ext,'codehelp',_GetCodehelpFlags(ext) ^ VSCODEHELPFLAG_HIGHLIGHT_TAGS);
typeless p;
save_pos(p);
next_word();
_UpdateContextHighlights(true);
prev_word();
_UpdateContextHighlights(true);
restore_pos(p);
_UpdateContextHighlights(true);
}