The 4 diodes are only really used when the motor(s) are turned OFF.
When the Arduino turns OFF the motor relay, that relay removes power going to the motor.
When the motor power is removed, the motor produces a voltage spike that can be hundreds of volts.
This is referred to as a kickback voltage.
This high voltage spike can interfere with or damage nearby electronics.
The 4 diodes snuff out any kickback spikes.
Therefore, the diodes prevent interference that occur if the diodes were not used.