The two-hour rule is an instruction to store food in the refrigerator or freezer within two hours of cooking. This is a good rule of thumb to prevent the formation of unwanted bacteria on cooked food. Also, this way, you will preserve most of the flavors in the dish.