Okay, then what are they there for? And then why are they armed?
Knowing Marines (including someone who has served in that capacity and is a friend of my daughter (SSgt, USMC)):
The first job of the Marine guards in the embassies is to secure, defend, and destroy if necessary, all of the cryptographic equipment, codes, ciphers, programs etc that might fall into the hands of the enemy if the embassy is in danger of being overrun or invaded by your enemy. If they overrun one of our embassies, that makes them the enemy under long-established standards of diplomatic conduct.
They kind of need to be armed to do that (I see the latest reports suggest two Marines were killed).