This tutorial covers the use of Template Data Language to work with mixed syntax in PhpStorm.
Let's go through the steps to have PhpStorm recognize different languages in one file.
We need to associate the new file type (*.js.php) with PHP (in our case) in Settings | File Types. If you do not want to use such custom extension, then you'll have to assign the full file name as a pattern, which is not recommended.
Please note that this setting is IDE-wide, so this file type association will affect all projects. Therefore, having a custom extension is the best way to proceed with it.
Once the Template Data Language has been specified, PhpStorm recognizes both languages. Our IDE provides syntax highlighting, code completion, inspections, refactorings and so on.
We can do similar things with CSS and embedded PHP. Here's a .css.php file for which I've specified the Template Data Language as CSS. It features inspections for both the CSS part of the syntax as well as the embedded PHP.