When sunlight passes through the canopy of a dense forest, the light is scattered by the dust particles and tiny water droplets suspended in the air, creating visible beams of light.
This is known as the Tyndall effect, which is similar to Rayleigh scattering, the process that causes the sky to appear blue.
However, Tyndall scattering is more intense than Rayleigh, due to the bigger particle sizes involved as light passes through a colloid. The same phenomenon happens when rays of light hit dust or car headlights shine on fog.