The FAA and the airlines (and some business aviation) have an agreement. If there is no space for the airplane, leave it on the ground. The FAA has a set of systems monitoring all flight plans, scheduled flights and the weather, mushes it all together to determine if there is room for the aircraft in the National Airspace System. If there is too much traffic at a certain point, then the FAA will issue a program, and tell the airlines to keep their aircraft on the ground.
If there is fog at an airport, and the rate the airport can take aircraft in is reduced to less than the volume of scheduled flights into the airport, then the FAA will issue a ground delay program (GDP). This ground delay will cause flights to be delayed at the departure airport. Typically the delay will begin after the weather starts slowing things down, and will continue until the forecast shows things will get better.
Most passengers find this frustrating, but the reason is quite sound. The flight is going to be late to that airport anyway. Rather than risk stranding passengers at another destination, because the aircraft had to hold waiting for a slot at the destination, and the aircraft ran low on fuel, the passengers are left at the departure airport, and can choose a different itinerary, or just wait it out.
Other programs include an airspace flow program (AFP). An AFP is used when there is a line of weather across several states, causing many flights to be planned to go around that weather, all at a single choke point. The choke point is like an airport, where not all flights can get through, and may have to hold to allow proper spacing. Rather than getting too many aircraft through a small hole, it is better to leave the aircraft at the departure airport, with a delay, rather than possibly holding, and diverting.
Any of the delay programs are just a delay. The flight is delayed a known amount based on forecast weather. Sometimes, the delays can be adjusted based on current local forecasts. Sometimes the weather is better than forecast, other times not.
The last major program is a full Ground Stop (GS) program. This is where the conditions at the destination airport are not conducive to landing any more aircraft. One scenario for a ground stop would be malfunctioning equipment at a destination, and the time to repair is not determined. The delayed aircraft may get an updated expected departure time, or they will get a next update time.
With the DOT 3hour rules and other reasons, some airlines may elect to cancel a flight or two due to one of these programs. Cancelling flights allow space to be made available. The FAA allows airlines to trade these spaces, or hold them for other flights. If airline A decides that it would be better to delay flight 123 that only is 60% full, they may decide to put most of those passengers on flight 456 that is 50% full, but leaving an hour later. That way the airline can make 48 people only a little late, and they will tell their friends how the airline "saved" them. The other 32 will just be frustrated, and may not complain too loudly.
The swaps and adjustments are part of the Collaborative Decision Making (CDM) program the FAA organizes. The CDM organization actually has several arms, and is chaired both by the airlines and the FAA. Some of the arms include groups working on weather, ground movement, and flight planning.
One of the programs the CDM group is working on, is collaborative flight planning. If the FAA and the airlines could make plans based on know congestion areas, then some of the programs might be eliminated. If the FAA gets a bunch of flight plans that all show the flights going around the south end of a storm, the FAA can suggest that going the north way might get the flight there sooner, even though the mileage is longer.
There is still a long way to go with all the information the airlines and the FAA have to get passengers to their destination when they want to be there. Things are getting better all the time.