If you decide to bring a jar of peanut butter or something like that, it couldn't be carried on, but it can be checked. One way to avoid it being crushed would be to put it in a shoe box and then into the bag. This would work for carry on or checked baggage.
Also, I would check with the airline about what you can bring as a carry on...I've heard that only food that will be consumed in flight can be carried on. I could be wrong on that though.