An explanation of how this works from the article:
JWST is able to analyse the light that passes through the faraway planet's atmosphere. That light contains the chemical signature of molecules in its atmosphere. The details can be deciphered by splitting the light into its constituent frequencies - rather like a prism creating a rainbow spectrum. If parts of the resulting spectrum are missing, it has been absorbed by chemicals in the planet's atmosphere, enabling researchers to discover its composition.
Note that they say the identification is ‘tentative’ and not robust yet.