Gray matter or grey matter is a type of neural tissue which is found in the brain and spinal cord. It is named after its distinctive brownish-gray color, in contrast with white matter, another type of neural tissue which appears white because it is coated in myelin sheathes. Many people associate gray matter with intelligence and intellect, because it is a major component in the brain, leading to slang terms like “use those gray cells.”
This type of neural tissue is composed primarily of cell bodies, along with their dendrites. White matter, by contrast, is made from nerve fibers. The purpose is to pass along sensory input, gathering information from the sensory organs and other cells and ensuring that it gets where it needs to go. The speed of communication is determined by the white matter, so one could think of the gray and white matter as the central processing unit of the brain.
People associate gray matter with intelligence for a good reason: when a brain is autopsied, it appears to be composed entirely of gray matter. Even before people understood the workings of the body, they recognized that the brain was clearly different, and many surmised that all of those gray cells had to be doing something. This tissue also requires a lot of energy, using about 20% of the body's energy at any given time and taking advantage of a copious blood supply.
Curiously, some ancient cultures notably did not attribute very much importance to the brain. The Egyptians, for example, discarded the brain during preparations for burial, believing it to be largely useless. They believed that intellect and the soul were centered in the heart, and some other cultures had a similar belief.
Research on the brain has shown that people have differing amounts of gray matter. The more dense the tissue in a particular region of the brain, the more intelligence or skill the brain's owner is likely to have. People with unusually high levels of intelligence or unique skills tend to have notably high levels of gray matter in the parts of their brains which correlate to their ability. Skilled musicians, for example, have an unusually large Broca's Area.
Incidentally, for those who are wondering why the brain is covered in a network of grooves and ridges, the answer is that these folds increase the surface area of the brain, maximizing the number of neurons which can be packed into this area. The alternative would be to have a massive smooth brain, which would require an absurdly large skull. In addition to looking preposterous, a big skull would be potentially dangerous to the host organism, and extremely impractical during birth.