DNA methylation is a vital modification process in the control of genetic information, which contributes to the epigenetics by regulating gene expression without changing the DNA sequence. Abnormal DNA methylation--both hypomethylation and hypermethylation--has been associated with improper gene expression, leading to several disorders. Two types of risk factors can alter the epigenetic regulation of methylation pathways: genetic factors and modifiable factors. Nutrition is one of the strongest modifiable factors, which plays a direct role in DNA methylation pathways. Large numbers of studies have investigated the effects of nutrition on DNA methylation pathways, but relatively few have focused on the biochemical mechanisms. Understanding the biological mechanisms is essential for clarifying how nutrients function in epigenetics. It is believed that nutrition affects the epigenetic regulations of DNA methylation in several possible epigenetic pathways: mainly, by altering the substrates and cofactors that are necessary for proper DNA methylation; additionally, by changing the activity of enzymes regulating the one-carbon cycle; and, lastly, through there being an epigenetic role in several possible mechanisms related to DNA demethylation activity. The aim of this article is to review the potential underlying biochemical mechanisms that are related to diet modifications in DNA methylation and demethylation.