See Ctext highlighting widget for a complete solution that works well.
Also see Jeffrey Hobbs Tcl source code to HTML compatible format converter [1]. Does some intelligent highlighting.
See also Looping over the contents of a text widget which includes code that lets you supply a pattern and apply a tag to all ranges that match that pattern.