The Caenorhabditis elegans pharynx (or foregut) functions as a pump that draws in food (bacteria) from the environment. While the "organ identity factor" PHA-4 is critical for formation of the C. elegans pharynx as a whole, little is known about the specification of distinct cell types within the pharynx. Here, we use a combination of bioinformatics, molecular biology, and genetics to identify a helix-loop-helix transcription factor (HLH-6) as a critical regulator of pharyngeal gland development. HLH-6 is required for expression of a number of gland-specific genes, acting through a discrete cis-regulatory element named PGM1 (Pharyngeal Gland Motif 1). hlh-6 mutants exhibit a frequent loss of a subset of glands, while the remaining glands have impaired activity, indicating a role for hlh-6 in both gland development and function. Interestingly, hlh-6 mutants are also feeding defective, ascribing a biological function for the glands. Pharyngeal pumping in hlh-6 mutants is normal, but hlh-6 mutants lack expression of a class of mucin-related proteins that are normally secreted by pharyngeal glands and line the pharyngeal cuticle. An interesting possibility is that one function of pharyngeal glands is to secrete a pharyngeal lining that ensures efficient transport of food along the pharyngeal lumen.