For 5 gal of beer in a 5 gal keg you need less sugar because the total relative headspace is less. A lot of people suggest 1/2-2/3 the amount you would use if bottling. In my experience I needed to use closer to 80% of what I would have bottling to get the same carbonation level, but maybe I don't fill my kegs as full as other people.
For only 3 gal of beer in a 5 gal keg, you need more sugar per gallon of beer than you would if you were bottling, but I don't really know how much more. If I were a little more sober I could probably use what I remember from my chemistry classes to calculate the difference.