Hello,
You need to use DOCXCustomizer, available in phpdocx 7 and newer releases for Premium licenses:
https://www.phpdocx.com/documentation/introduction/docxcustomizer
or the searchAndColor method:
https://www.phpdocx.com/api-documentation/docxutilities/search-keyword-Word-document-and-color
Regards.