Yes, your diet can play a major role. Another factor that seriously comes into play is the cleanliness of your teeth, i.e how often you floss, brush or use fluoride.
Gingivitis is the inflammation of the gum tissue, or gingiva. This condition is usually caused from a lack of proper dental hygeine. The excess food particles and bacteria cause the gum tissue to inflame.
Gingivitis is gum disease caused by plaque on your teeth and bacteria infecting your gums. It doesn't come from any food in particular, it is normally a result of not brushing and flossing your teeth.