normally, style changes will be done by the lexer assigned, so make sure that your
files do not get styled by an internal lexer as well, otherwise you are in trouble as there
is no safe way to determine which lexer (yours or the internal one) gets called last and therefore
does the styling one sees. See here for the API description. Be aware that npp uses scintilla 3.5.6, so, not all api calls are available.
For a starting point, I posted here an example how such an script/prog could look like.
Cheers
Claudia