Hi,
The output panel uses a plain text area, I think the best would be for
the script itself to create their own output panel that uses a
SyntaxHighlightTextArea (which would do the highlighting for you).
There's a dedicated group just for scripting:
https://groups.google.com/g/zaproxy-scripts/
though if you want to contribute code changes to support this use case
more easily this group is a better one :)
Best regards.