The characters combine to mean “outside male elder.” This term is a product of China's traditionally patrilineal society, where the family line, name, and inheritance passed through the father. Therefore, the father's parents (爷爷, 奶奶) are the “inside” or core family, while the mother's parents (外公, 外婆) are the respected but “outside” family.
The distinction between 外公 (wàigōng) and 爷爷 (yéye) is one of the first cultural hurdles for English-speaking learners. In English, “grandfather” or “grandpa” is used for both. The Chinese specificity reveals a core aspect of traditional Chinese culture: patrilineal lineage. Historically, a woman would marry *into* her husband's family, and her children would be considered part of his family line. Her family was thus the “外” (wài) or “outside” family. This linguistic distinction was a marker of social structure, not necessarily emotional closeness. In modern China, especially in urban areas, this traditional structure has weakened. It is very common for the maternal grandparents (外公 and 外婆) to be deeply involved in raising their grandchildren, sometimes even more so than the paternal grandparents. The emotional bond with one's 外公 can be just as strong, if not stronger, than with one's 爷爷. However, the linguistic distinction remains a fundamental part of the language that every learner must master. It's a living fossil of a past social structure that still shapes the language today.
外公 is a standard, widely understood term across all of China. It's neither overly formal nor overly casual.