As a mere example, I want to apply the class \"fancy\" to all occurrences of the sign \"&\" in the document.
fancy
&
The C
There's a "highlight" plugin that does almost exactly what you describe:
http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html