Here is a link to a great article by Dr. Perlmutter MD ("Dementia: Is Gluten the Culprit?) which summarizes the link between eating a diet high in sugars and starches (especially foods containing gluten) and brain health.
If you want to keep your brain functioning optimally and prevent dementia, the bottom line is this: avoid gluten and other high glycemic foods. Eat a diet higher in healthy fats, like nuts, seeds, olive oil, small amounts of grass-fed beef, omega-3 enriched eggs and wild caught fish. Load your plate with (some) fruits and plenty of vegetables. Strive to maintain a fasting blood insulin level of less than 8 and a total carbohydrate intake for the day of no more than 60-80 grams.