There is actually no grace period. They can be legally picked up and put in deportation proceeding the minute they're fired and they start accruing illegal presence immediately.
But the USCIS generally approves petitions to change from one employer to the next if the gap between jobs is short. 30 days is acceptable