IMHO, humor is another form of communication that comes in play when we interact with people. When companies identify humor as a cultural value, they are communicating an expectation--or in some cases, permission--that humor is not only acceptable, but encouraged.
When we see it this way, use of humor becomes more purposeful. As with all other communication, think about how to deliver with intended impact. That includes making your intentions evident to the receiver, and getting the desired response--a smile, chuckle, laugh, or even a stronger rapport or connection. If the chances of that happening are outweighed by the chances it won't work based on what you know, then don't do it. When it misfires, address it--right away. Ok? Ok. "So a management consultant walks into a bar..."