On 13 July 1878, the great powers of Europe signed the Treaty of Berlin, recognizing the independence of Montenegro, Romania, and Serbia from the Ottoman Empire.
At the time, Montenegrins generally considered themselves part of the Serbian nation. Their first constitution even said “there is no other nationality in this land except Serb nationality”. So in 1860 Prince Danilo adopted the Serbian tricolour as his country’s national flag. The one difference was the shade of blue.
Honestly I’m not sure what prompted the change. Could have been a desire to differentiate the country a bit, or it could have something as simple as the available materials when the flag was first designed.