The composition of a planet's atmosphere can be measured during a transit by analyzing what?
The scattered wavelength.
Imagine that someone is observing the Earth from a remote location.
Observing our Sun they see that there is a blue component, but when the Earth transit in front of the Sun the blue component is scattered by our atmosphere (this is why we see the sky blue) while the read component is not scattered (this is why during a Moon eclipse the Moon seems red).
So who is observing us deduct that we have an atmosphere that scatters blu but not red.
A wavelength is scattered if the object that encounter on its way is of the same size of the wavelength. So the average size of air molecules is in the order of the blue wavelength.
On Mars, for example, the air is smaller and the planet scatter more in red than in blue.
With this system you can guess which molecules the atmosphere should have in order to have that size and scatter those colors.