You can only set one style for a text layer via script, if you need multiple styles you need to create more text layers and find a way to place them.
If you only need to change the color, or other properties that is not the font, you can maybe look into using an expression selector on the text layer.
To find a word you can use
to find where the word is.
To find words surrounded by symbols you might have to use a regular expression
var text = "Lorem [ipsum] dolor [sit] amet"
var match = text.match( /(\[.*?\])/g );
console.log( match ); // Logs ["[ipsum]", "[sit]"]
You could then maybe use that with indexOf to find the indexes.
Hopefully that might help you figure something out