Food allergies are your body's inappropriate response to certain proteins. Depending on what you're allergic to, your body misidentifies the proteins in those foods and thinks they're dangerous. Then it releases an antibody called immunoglobulin E and tells it to send out chemicals to combat the allergen. Those chemicals include histamine, which is responsible for most allergic symptoms.
Allergic symptoms vary from person to person. For some people, food allergies can cause swelling, tingling or itching in the mouth. While that doesn't necessarily encompass sore gums, it might. Some people with allergies to certain pollens also react to specific fruits and nuts as though they were allergic to the foods; cross-reactive oral symptoms like these also include swollen, itching or tingling mouths.
The cause for sore gums is more commonly the result of poor tooth brushing or flossing techniques than food allergies, though. Brushing your gums too hard or attacking them with floss damages the sensitive tissue and ends up hurting you. Another frequent reason for sore gums is gum disease; gingivitis is one of the most widespread gum diseases. Periodontitis is more serious than gingivitis, but both can cause pain. They occur when bacteria get into your gums and cause swelling; sometimes periodontal disease also causes your gums to bleed. Some people end up with sore gums when they develop canker sores, which are caused by viruses. The pain goes away when the canker sore heals. Chemotherapy is also a known cause of painful gums. In addition, tobacco can cause your gums to be sore or diseased. Hormonal changes in women, like puberty, menstruation and menopause, change the blood flow in your body and can end up swelling your gums. Your dentist will best be able to figure out the source of your sore gums.