The brace matching requires both open and close braces to be in the same style AFAIR, and that's how it knows it's not a string/command/whatever else is different. In your example, the last closing parenthesis has style 0 instead of 3 (because it's not part of a valid variable expression).
IMO this is invalid, because it's basically the same as having the brace in a comment or a string, etc. and there you would see what's wrong. IMO, if anything, change the styling for style 3 (`identifier`) to some different color so you discriminate it from style 0 (`default`).