3d rotation type issue

In this game I’m programming, I’m trying to mirror a “rotation matrix” around the global x axis, but the formulas I tried using arn’t reliable, a lot of the rotations just point off in a unpredictable direction.
This is in a 3d engine so I can use built in things like matrix or even quaternion.

Basically I just want to flip the object horizontally, but because it has a local transform the problem comes up with a world/global flip. What is the proper way to do this?