Colonel Pickering (The Gentleman) we learn is the author of the book Spoken Sanscrit. Pickering is a linguist of such great renown that Higgins was on the way to India to meet him. Pickering was also in search of Higgins, who is a phoneticist (a scientist who studies the sounds of language) and the author of Higgins Universal Alphabet. Higgins is writing down (in phonetic symbols) the speech of the people around him. He is studying the various accents of people in London, and he claims to be able to trace the origins of he speaker within a few streets, just by hearing him or her talk!
The two linguistic scholars are professional colleagues and become friends -- and together they enter into the bet which transforms Eliza from a humble flower-girl to a lady.