See Ctext highlighting widget for a complete solution that works well.
Also see Jeffrey Hobbs Tcl source code to HTML compatible format converter [L1 ]. Does some intelligent highlighting.