ZeroMQ is not a messaging broker, it's a socket abstraction. (I interpret the zero in ZeroMQ to mean "no".) So they are not comparable at all. You can build a broker with ZeroMQ, which people have done [1], in the same sense that you can build a broker on plain TCP sockets.
I believe the same applies to Nanomsg.
[1] https://github.com/zeromq/malamute, https://github.com/sintaxi/waterfront, https://github.com/zeromq/zbroker