Vincent Spaulding was planning on digging a tunnel to rob a bank, by looking at his pants, he knew that he was digging a tunnel. He got that piece of information by his boss telling Sherlock that Vincent spends a long time in the cellar. Sherlock started beating the ground after this, to see where the tunnel led to.