Without more information it is hard to be certain; but, the most likely cause is that the board was installed backwards.
Looking at the photo, the damage on both boards seem to be centered around pin 20 and 21 of the driver IC. A schematic of a similar board shows these are both 5V inputs (DIR and *ENBL). These signals connect to the top and bottom pins of the left connector to the RAMPS.
Since these are inputs, the most likely cause of a damage to these would be a high current over-voltage condition that caused the upper protection in the IC to conduct. This would require >5.5V and a lot of current.
The RAMPS board routes these signals to I/O pins on the ATMEGA processor - see RAMPS Schematic. These can't easily go above 5V without blowing out the ATMEGA and they are not generally high enough current to cause the damage you see.
The most likely high current and voltage would be the 12V motor supply line (VMM). This comes into the board on the top pin of the right RAMPS connector.
Accidentally installing it 180 degrees (which is super easy to do since the connector is not keyed) would connect the 12V VMM to IC pin 20 instead and you would likely see the same burn mark you see on your board.
A better board design would have been to key the connectors by using two sizes and/or cutting a pin so it couldn't get plugged in backwards - but they didn't.