Yes. Spent coffee grounds are one of the better things you can put in a compost pile. The caveat is that they count as a green, not a brown, despite being brown, so they need dry material mixed in with them or they mat into a sour layer. Below: whether you can compost coffee grounds, why, how much to add, and the mistakes that cause trouble.
Spent grounds are roughly 2% nitrogen by weight, which puts them in the same category as grass clippings and vegetable scraps. Microbes need nitrogen to build proteins, and grounds deliver it in a form that is already finely divided: enormous surface area, nothing to chop. They break down fast.
They are also close to pH neutral once brewed. The widespread belief that grounds acidify your soil comes from unbrewed coffee, which is acidic. Brewing strips most of that out. If you are adding grounds specifically to acidify soil for blueberries, you will be disappointed.

Mix, do not layer. A 2cm layer of wet grounds compacts into something closer to sediment than soil, water sheds off it, and the material underneath goes anaerobic. Scatter them and fork them through, or tip them onto a bed of shredded leaves or torn cardboard and turn once.
Paper filters go in too. They are unbleached cellulose and count as a brown, which conveniently offsets the grounds they arrive with.
Up to about a fifth of the pile by volume is comfortable. Beyond that you are relying on a single material for a lot of your nitrogen, and grounds are fine enough that a large quantity compacts no matter how well you mix.
Treating them as a brown because they are brown. The single most common error. Colour tells you nothing; moisture and nitrogen content do.
Dumping the whole caddy in one spot. Creates the matted layer described above.
Expecting them to fix acidity. They will not, meaningfully.
You will find claims that coffee grounds repel slugs and suppress weeds. The slug studies are thin and mostly involve caffeine concentrations far above what spent grounds contain. There is better evidence that fresh grounds can inhibit seed germination, which is a reason to compost them first rather than sprinkling them straight onto seedlings, but not a reason to avoid them.
More materials in the what can you compost library. If your pile already smells sour, that is compost smells bad. For why greens and browns matter in the first place, see browns and greens or start at how to compost.
Independent sources worth reading alongside this page: EPA, Composting at Home · Cornell Waste Management Institute.