Python 3, 263263 227 bytes
def f(m):
p={(x,y):[(a,b)[c for a,bi in[[x,y+1],[x,y-1],[x+1,y],[xin[-1,y]]if1]for c in[(ax,by+i)in m and m[a,b]<m[x(x+i,y]]fory)]]for x,y in m};d={c:0 for c in p if not p[c]}
while len(p)-len(d):
for c in p:
for b in p[c]:
if b in d:d[c]=max(d[b]+1,d.get(c,0))
return max(d.values())
-2 bytes thanks to BMO
Takes grids in the format {(0, 0): 1, (1, 0): 2, ...}
. This format can be generated from the example format using the following utility function:
lambda s,e=enumerate:{(x,y):int(n)for y,l in e(s.split('\n'))for x,n in e(l.split())}