The membranes that cover your lungs and line your chest wall are called the pleura. A small amount of fluid sits in the pleural space between the 2 layers to allow them to move freely when you breathe in and out. When the pleura get inflamed, they rub and grate against each other, causing pain. This is pleurisy (also known as pleuritis).
Image credit: CRUK via Wikimedia Commons