It's not uncommon for kids to have bouts of constipation when switching from formula to whole milk, but since your son already struggles with hard stools, he probably isn't getting enough fiber and water in his daily diet. To keep his bowel movements on track, start offering him a selection of high-fiber foods like wheat bread (some are even fortified with extra fiber), wheat crackers, high-fiber cereals, fruits like prunes, pears, and blueberries, and even a little pear or prune juice. Although extra veggies are always a good idea, it can be challenging to get a toddler to eat them. If your son turns his nose up at broccoli, try refried beans or even hummus instead. Of course, if all else fails you can sneak the fiber in by cooking with wheat germ or putting an age-appropriate dose of Benefiber into his favorite drink.
As for starting cow's milk, it's absolutely fine as long as your child hasn't had any problems with dairy so far (like allergies). It's true that cow's milk can be a little constipating, but it's still important for your toddler's development, so just be sure to crank up the fiber in his diet even more once he starts on milk. And remember, a high-fiber diet is important for lifelong health (not just digestive regularity) so you're doing your son a favor by encouraging it early.