About once a year, the entire batter and tray/box should be cleaned. It it is mounted outside where water can run off you are all set. It it is mounted inside, you will have to remove it because it is going to get messy.
Mix up about 2 quarts of warm water with a standard size box of baking soda. Stir until it is all dissolved. MAKE CERTAIN THE BATTERY CAPS ARE ON SECURELY ! Using a cheap stiff paint brush (typically called a "chip" brush), liberally apply the solution all over the battery. If it foams in any area, keep applying more solution. Once all foaming action stops, rinse well with water.
The same process so be done on the battery cable terminals and any brackets or hold downs. Once the batteries are reinstalled take a generous "gob" of grease (Vaseline works well) plop it on of the terminals and work it underneath and around the battery posts.
(If you are super lazy and the battery is mounted outside, take a garden hose with a nozzle and hose it off. Better than nothing. You will have to do this more often.)