Is it possible to show syntax highlighting in the "Insert TeX code" boxes in LyX?
This would be very handy when one wants to input something longer using code.
No, not at the moment.
According to the LyX bug tracker (http://www.lyx.org/trac/ticket/4343) this has been a longly requested feature and the LyX developers are still on it – with recent changes giving some hope that this might be available in a next major release.
For larger parts of ERT (evil red text = LyXism for inserted (La)TeX code) I generally employ an external editor and use Copy & Paste to move the code between LyX and my Editor. Instead of Copy & Paste one can also maintain the the TeX code in an external
.tex file inserted with File > Insert > Child Document (Include Type = Input), which is useful during development or for maintaining larger parts of code.