Mr. Gao, a diminutive man with a booming voice, remembers how different it used to be.

“Until this project, I didn’t even know that what I was speaking was a dialect, because everyone around me used to speak like that,” Mr. Gao said in his new apartment, not far from the hutong where he lived for more than 60 years.

According to the United Nations, nearly 100 Chinese dialects, many of them spoken by China’s 55 recognized ethnic minorities, are in danger of dying out. Efforts are also underway in Shanghai, as well as in Jiangsu and five other provinces, to create databases as part of a project under the Ministry of Education to research dialects and cultural practices nationwide.

Yet the potential loss of the Beijing dialect is especially alarming because of the cultural heft it carries.

“As China’s ancient and modern capital, Beijing and thus its linguistic culture as well are representative of our entire nation’s civilization,” said Zhang Shifang, a professor at the Beijing Language and Culture University who oversaw the effort to record native speakers. “For Beijing people themselves, the Beijing dialect is an important symbol of identity.”

The dialect is a testament to the city’s tumultuous history of invasion and foreign rule. The Mongol Empire ruled China in the 13th and 14th centuries. The Manchus, an ethnic group from northeast Asia, ruled from the mid-17th century into the 20th. As a result, the Beijing dialect contains words derived from both Mongolian and Manchurian. The intervening Ming dynasty, which maintained its first capital in Nanjing for several decades before moving to Beijing, introduced southern speech elements.

The dialect varied within the city itself. The historically wealthier neighborhoods north of the Forbidden City spoke with an accent considered more refined than that found in the poorer neighborhoods to the south, home to craftsmen and performers.

In Shanghai, some schools teach in Shanghainese rather than Mandarin. The Beijing city government has explored the idea of developing teaching materials in the Beijing dialect. However, these proposals have been criticized by those who fear such lessons would diminish the effectiveness of Mandarin-language education.