Setting text colour between symbol markers

Hi, I’ve wanted to add some highlighting to txt files. For example, within a txt file like
This is some plain text !code! char text[] = "Word"; int fontSize = 5; !code!
Where, the plain text is a single colour. But, the text between the !code! markers is coloured differently.
I’m not sure how you can specify that this is only applied to .txt files, and to find/colour between the markers.

If you have any ideas, please let me know, thanks!