How do I clean green and brown substances from the connectors of battery-operated devices?
First you'll want to have a good pair of gloves, this stuff can be nasty and you don't want it on your skin.  Once the batteries are removed, and disposed of properly. Mix baking soda and water into a paste, and apply it to the affected area using a cotton swab (Q-tip). Leave the paste on the terminals for 5-10 minutes, then wipe it off with a damp cloth. Repeat as necessary. Wipe the terminals with a clean dry cloth, and allow to air dry completely.

Once the terminals are clean, you can apply a contact cleaner like DeoxIT®. 



Which will further clean the terminals, as well as protect them and restore their conductivity.

If the leakage is not that bad, you may be able to clean it with just the contact cleaner.  For heavy corrosion damage the baking soda paste should remove the bulk of the mess, and the contact cleaner will repair some of the unseen damage to the contacts.