Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
A fasting person is required to be careful to keep his fast valid and avoid all that could nullify his fast. The way of rinsing one's mouth is the same for a fasting and a non-fasting one. But the fasting person should avoid drawing the water deep into his nose. The Prophet (Sallallahu Alaihi wa Sallam) said: "Exaggerate when rinsing your nose unless you are fasting." [Reported by four Imams of Sunan].
However, if the water reaches into the throat or stomach unintentionally or due to forgetfulness, it does not affect the fasting. The Prophet (Sallallahu Alaihi wa Sallam) said: "Whoever forgets he is fasting, and eats and drinks is to complete his fast, as it was Allah who fed him and gave him something to drink." [Reported by Imams Al Bukhari and Muslim]. If one does so intentionally he commits sin and has to make up that day later.
Allah knows best.