Yes, you can compost pears.
Pears rot down pretty quickly – whether you want them to or not! *grumbles about having to clean out the fruit bowl many times when we’ve missed that hour window when pears are ripe but not over-ripe*
Pears are classed as “greens” in composting terms: if you’ve got a LOT of pears or other “greens”, add alongside “browns” (like dried leaves or cardboard) to keep the compost heap balanced. (Balanced heaps will compost down faster.)