Leitmotif is first asking if there are batteries in your solar panel system ?
Thats normally how they are set up - the PV cells charge a battery or bank of batteries, then the batteries are connected to teh inverter which actually makes teh AC power.
The batteries give you some reserve/surge capacity that you wouldnt have with just solar panels.
So IF you have a battery or battery bank, just read battery voltage and switch on that. Most battery banks are 12v (like a car), so 13vdc on the battery is considered charged/charging and 11.5 or 12vdc on the battery means that it is discharged or low.
Measure the battery voltage and if it is low, switch to grid power, but if it is above 13vdc, stay on the inverter (or swtich back to the inverter).
notes: some battery banks may be 24v, 125v or 250v dc busses - adjust your setting appropriately =)
The text about gravities is basically saying - if you have multiple batteries connected in series, you need to monitor their state of charge accurately - the only way to do this is to dip a tester in the battery acid and check the specific gravity of the acid - that is the best indiciator of how much charge is in an wet lead-acid battery. If you dont have lead acid wet cells (most larger batteries are, but my plant has banks of NiMH batteris...) then 'taking gravities' wont work.
If you would have told us how many amps/watts/sq. ft./the size of your stuff, we'd be able to give you some better guesses =)
if you dont have a battery, this wont work.
Most inverters (even the ultra cheap ones at radio shack) have a 'low voltage cut off' which causes them to beep or throw an alarm when their supply voltage is too low to operate. See if your inverter has contacts or an output for this, (if the solar panel gets shaded, this will cause the input voltage to the inverter to drop) and use it to tell you to switch back to grid power.
Does this help ?