There is a school of thought called “If it fits your macros,” which would say that any carbohydrate under your 20 g/day limit should be fine. However, one 12-ounce glass of Barq’s Root beer contains 45 grams of sugar, which is over twice the daily carb limit we recommend. So if you are having one serving, and especially if you are having more than one a day, then you are consuming far more carbohydrate than we recommend.
Furthermore, each molecule of table sugar, sucrose, consists of a molecule of glucose bonded to a molecule of fructose. The enzyme sucrase cleaves that bond, leaving in the glucose to be handled in the usual manner (i.e., it will raise your blood sugar and hence your insulin, which is not what we want on a ketogenic diet).
But the fructose can be dealt with only in your liver, which can only handle so much at a time. The same metabolic pathway handles ethanol, fructose, and branced-chain amino acids, and if that pathway is overwhelmed, it promotes fatty liver disease, by means of a process called de novo lipogenesis. When we drink soda or fruit juice, there is no fibre to slow the absorption of the fructose into the liver, so the whole amount hits pretty much simultaneously. This is not good for the liver, as you can probably imagine.
As far as high-fructose corn syrup is concerned, the percentage of fructose is slightly higher than it is in sucrose, but the effect is essentially the same.
So the upshot is that while carbohydrates are to be avoided on a ketogenic diet, sugars are especially to be avoided.