The flehmen response occurs not just in cats but in horses and deer and other animals, where it is a bit easier to see.
On the outside, it looks like the cat is grinning or even grimacing as it opens its mouth and draws the air into sample it. This usually happens when it’s sniffing the urine of a cat that’s in season or where a tom has sprayed.
It gives cats a great deal of information about that scent as it enables it to draw in the air over a special organ called Jacobson’s organ found in the roof of the mouth behind the front teeth. Here the cat can concentrate the scent and smell/taste it, giving it a lot of information.