This is called "ventilation." There are two basic reasons for ventilating the roof. Dangerous gases and dark smoke accumulate in a burning building making it impossible for firefighters to see. When a hole is made in the roof, smoke and gases escape because heat and smoke rise, this makes it much easier for the firefighters in the building to see. It also reduces the possibilities of backdraft (an explosion of heated gases) and flashover (a quick transition to a fully developed fire).
Another reason is to see how far the fire has progressed. One of the fastest avenues through which fires spread is the attic. Heat and smoke rise into the attic where fire can move quickly. Firefighters may go ahead of the fire on a roof, cut holes to access the attic, and stop the fire from spreading.