You don't clear customs at PEK during a transit, but there is a passport check (where they used to stamp passports with a special transit stamp, but I don't think they do that anymore) and then a security check. You won't have to collect bags.
The process can take anywhere from 5-35 minutes. I've found 6-9am being particularly busy times to clear the transit checkpoints.