It's possible to override the syntax table for specific syntactic constructs by overriding the variable syntax-propertize-function. It should be bound to a function that set the syntax-table text property on the part of the buffer where the default syntax table should be overridden.
One way to do this it to use the support function syntax-propertize-rules.
Ideally you'd try fixing the highlighting in the mode itself. I am the maintainer of yaml-mode, if you have ideas how to do this without ending up writing a YAML parser, please let me know on its issue tracker.
One possible workaround for programming languages with comment syntax is to put a comment starter on the affected line, then a string terminator ...
In my "my-mode-font-lock" function, this is what I ended up using:
; This regexp matches "function someName(", and sets a font face to "someName"
; This starts at the end of the previous regexp
; It matches everything up to "," or ")" - ...