For syntax highlighting, StackExchange uses a general-purpose syntax highlighter (probably something like prettify?), which guesses what to highlight based on the most common languages: C-like languages, Python, etc (and often gets highlighting of other languages wrong, e.g. when you have a Haskell function with a "prime" in it, everything after the
' is highlighted as if quoted.)
For this TeX.SE, it seems worthwhile to use a syntax highlighter that is more tuned to (La)TeX. How could we go about this?
A toy example of something that ought to be highlighted correctly:
\item This is # not a comment
\item This is % a comment
A good syntax highlighter would recognize which lines are comments, and also probably do something with 'begin', 'end' and 'item' (as the LaTeX Wikibook does).
(It seems a weaker version of this has been asked before as Syntax Highlighting Hints, and there's even a somewhat simple hack that is not implemented. Irrespective of all that history, consider this another request for TeX-specific syntax highlighting on this website, not necessarily using any of the more general solutions.)