Getting B+ matrix (Warshall algorithm) in Matlab
This post may help you in removing a loop:
http://mathforum.org/kb/message.jspa?messageID=845980

Furthermore, one way to speed up your code is to use a short circuit logical operator:

B(i,k) || B(k,j); 


Also it seems to have a small effect if you use a logical matrix as input rather than a double:

B = logical(b);


Last and least, it would be nicer to initialize Bm with the datatype that it will have:

Bm = false(n)