Menstrual blood is composed of a mixture of blood (blood cells), vaginal secretions, endometrial cells and inflammatory cells.
I have found no study investigating the change in colour of mentruation blood .
However, the presence of endometrial cells (mucosa lining of the uterus) and necrotic cells (from the endometrium) is supposed to be highest during the first days of menstruation where the stratum functionalis gets cleaved from the stratum basalis in the endometrium.
During the end of menstruation most of these cells have been expulsed and the new lining of the endometrial wall has developed, slowly "covering" previous bleeding vessels from the underlying mucosa.
This could possibly explain the change in colour you are mentionning.
Some weeks ago, I have answered a question on the menstrual cycle including some points regarding the uterine wall and its changes during the cycle:
How does my body know how long a month is?
Of course, these explanations apply to a "physiological" condition, and not to a pathological condition where things can be different.
Yang H, Zhou B, Prinz M, Siegel D. Proteomic Analysis of Menstrual Blood. Molecular & Cellular Proteomics : MCP. 2012;11(10):1024-1035. doi:10.1074/mcp.M112.018390.