X-bar theory is a theoretical framework in syntax that explains how phrases are structured and how they relate to their components. It proposes that every phrase has an intermediate level of representation, called the X-bar level, which organizes elements like the head, specifier, and complements of a phrase. This hierarchical structure helps to illustrate how words combine to form larger phrases and how those phrases function within sentences.