We study the synchronization of two rotating pendula mounted on a horizontal beam, which can roll on the parallel surface. The pendula are forced to rotate by different driving torques. It has been shown that after a transient two different types of synchronization between the pendula can be observed. The approximate analytical methods allow us to derive the synchronization conditions and explain the observed types of synchronous configurations. The energy balance in the system allows us to show how the energy is transferred between the pendula via the oscillating beam.