The Highlight plugin provides the ability to apply syntax colouring to text.
See https://tiddlywiki.com/plugins/tiddlywiki/highlight