The difference is a bit a subtle one. A garden is there for plants (and sometimes animals). You have a well-cut lawn, bushes, maybe some trees. You can grow crops and flowers in a garden. The yard (or court), on the other hand, is more like a free space, mostly between buildings. It's typically plastered with some patches of grass and a few plants, but mainly intended to give people an open resting place.
There's a big difference between garden and yard, depending on whether you're speaking American English or British English (not sure if the Danes make this distinction - I'll have to ask my Danish friend). Yard in AE is the entirety of a person's land, not the house. Like, the kids are throwing the ball in the yard, but the dogs are running all over the place, stealing the balls. A garden is a specific place where plants (not grass), flowers, veggies, etc have been planted. You'd be put out with the kids/dogs if they were running through your garden. I believe that in BE, a garden is what you'd call your entirety of your property (not the house), so you could go play/throw balls out in the garden. In AE, a courtyard is generally a walled in section attached to the house/main building (like a castle), and the walls are generally brick or stone. Could be paved with stone/cement, have grass. Might have some areas of cultivated plants. Probably lots of seating to relax in. (that's in AE, not sure what a courtyard is in BE).