I see that we have a function:
void CodeCompletion::UpdateEditorSyntax(cbEditor* ed)
which give a set of tokens(keywords) as member variables to scintilla control, so that it can highlight them, by
ed->GetControl()->SetKeyWords(3, keywords);
ed->GetControl()->Colourise(0, -1);
So, if we put a mouse in a function body, and let our parser parse the function body, and give scintilla control all the local variable tokens, and finally we can only highlight them inside the function body by
ed->GetControl()->SetKeyWords(3, local_variables_list);
ed->GetControl()->Colourise(begin_of_function_body, end_of_function_body);
EDIT: some old similar discussion:
CC based semantic highlight