The synchronization of the motion of microresonators has attracted considerable attention. Here we present theoretical methods to synchronize the chaotic motion of two optical cavity modes in an optomechanical system, in which one of the optical modes is strongly driven into chaotic motion and is coupled to another weakly-driven optical mode mediated by a mechanical resonator. In these optomechanical systems, we can obtain both complete and phase synchronization of the optical cavity modes in chaotic motion, starting from different initial states. We find that complete synchronization of chaos can be achieved in two identical cavity modes. In the strong-coupling small-detuning regime, we also {produce} phase synchronization of chaos between two nonidentical cavity modes.