A dermoid cyst is a congenital lesion containing various dermal structures, whereas a pilar cyst is an acquired cyst from the outer root sheath of a hair follicle, almost always on the scalp.
An epidermoid cyst arises from the epidermis, contains cheesy keratin, and can occur anywhere, while a pilar cyst is firmer, arises from the hair follicle, contains more homogenous material, and has a strong predilection for the scalp.
A lipoma is a soft, lobulated fat tumor in the subcutis, much softer than the firm, tense, dome-shaped pilar cyst.