Plugin for language mix HTML, JS, CSS + 2 ECMA code blocks?

i'm struggling with a template engine file for generating html-files from a desktop app (based on QT, if this helps ...).

such a template generation file consists of a form block on top (setting up a form presented inside of the app mentioned above for configuring some values for the desired HTML output). this block is a ECMA-262 script wrapped in php style <?ggf .... ?> tags. e.g.

form.addLineEdit("htmltitle","HTML Page Title",0,"");
form.addLine(); ....

then a processing section is following to work with the form values from above. it's also based on ECMA -262 and wrapped in <?ggs ... ?> tags. e.g.

function writeUserdata(v)
var s;

after this section the html assembly for the output starts with plain HTML, JS and CSS code and <?ggs ... ?>  injections for retrieving values / variables calculated above. e.g. 

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title><?ggs document.write(document.expandVariables(htmlTitle)); ?></title>

is there a way to create a language / syntax coloring template/plugin in/for phpstorm?

any tipps or hints for pointing me in the right direction is very appreciated. thanks a lot in advance!



thank you, Konstantin Annikov!
this indeed doesn't look very easy and as java is involved i'm out of luck here.
is there a way to make phpstorm recognize these script parts between the <?ggf> and <?ggs> tags as ecma?


thanks again!
this looks promising. i'll give it a test shot asap and let you know.