You can do this with the plugin API
1. Use view.sel() to get the current selection.
2. Then use find_all() on the current selection
3. Then use add_regions with different scopes.
The scope is used to source a color to draw the regions in, it should be the name of a scope, such as "comment" or "string".
You can also use show_input_panel() to ask the user which scope to color the current selection with - then supply the scope entered in the input panel to add_regions.