You encounter this behavior because the syntax highlighter in Pandoc has updated its syntax definition for the R language in Pandoc 2.11. That means the R code is not parsed the same by the highlighter - usually an update of the engine means better parsing - and even if the underlying color have not changed, they do not apply the same as the parsing was different. For example, set is now see as a function so it has correctly a different color than TRUE which is a logical condition token.
I won't go more into details about how syntax highlighing engine works here. But that is the reason.
You get this by switching RStudio version because RStudio 1.4 now ship with Pandoc 2.11+ and RStudio 1.3 ships with Pandoc 2.7.3.
Rmarkdown and RStudio are just using the Pandoc version associated with it, they do not do anything regarding syntax highlighting on this one. It is all Pandoc.
If for some reason you would like to have the previous colors (which where applied with a less good parser), you'll need to export the theme file from Panod 2.7.3, and use it with Pandoc 2.11
See more there: https://pandoc.org/MANUAL.html#syntax-highlighting