One knows that $P(S_n,n)$ is a martingale iff $P(s+1,n+1)+P(s-1,n+1)=2P(s,n)$ and $Q(B_t,t)$ is a martingale iff $2\partial_tQ(x,t)+\partial^2_{xx}Q(x,t)=0$. Assume that $P(S_n,n)$ is a martingale and, for a given $d$ and for every $h>0$, let $$ Q_h(x,t)=h^{d}P(x/\sqrt{h},t/h), $$ in the sense that one evaluates $P(s,n)$ at the integer parts $s$ and $n$ of $x/\sqrt{h}$ and $t/h$. If $Q_h\to Q$ when $h\to0$, writing $\partial_t$ and $\partial^2_{xx}$ as limits of finite differences of orders $1$ and $2$, one sees that $2\partial_tQ+\partial^2_{xx}Q=0$, hence $Q(B_t,t)$ is a martingale. Example: $P(s,n)=s^2-n$. For $d=1$, $Q_h(x,t)=x^2-t$ hence $Q(x,t)=x^2-t$. Other example: $P(s,n)=s^4-6ns^2+3n^2+2n$. For $d=2$, $Q_h(x,t)=x^4-6tx^2+3t^2+2ht$ hence $Q(x,t)=x^4-6tx^2+3t^2$. In the other direction, to deduce a martingale in $S_n$ and $n$ from a martingale in $B_t$ and $t$, one should probably replace each monomial by a sum of its first derivative. This means something like replacing $q(t)=3t^2$ by $\displaystyle\sum_{k=1}^n(\partial_tq)(k)=3n^2+3n$ but I did not look into the details. <hr> **Edit** (Thanks to The Bridge for a comment on the part of this answer above this line) Recall that a natural way to build in one strike a full family of martingales that are polynomial functions of $(B_t,t)$ is to consider so-called *exponential martingales*. For every parameter $u$, $$ M^u_t=\exp(uB_t-u^2t/2) $$ is a martingale hence every "coefficient" of its expansion along increasing powers of $u$ is also a martingale. This yields the well known fact that $$1,\ B_t,\ \frac12B^2_t-\frac12t,\ \frac16B^3_t-\frac12tB_t,\ \frac1{24}B^4_t-\frac14tB_t^2+\frac18t^2, $$ etc., are all martingales. One recognizes the sequence of Hermite polynomials $H_n(B_t,t)$, a not very surprising fact since these may be defined precisely through the expansion of $\exp(ux-u^2t/2)$. So far so good. What could be an analogue of this for standard random walks? The exponential martingale becomes $$ D^u_n=\exp(uS_n-(\ln\cosh(u))n) $$ and the rest is straightforward (in theory) and somewhat messy (in practice): one should expand $\ln\cosh(u)$ along increasing powers of $u$ (warning, here comes the family of Bernoulli numbers), then deduce from this the expansion of $D^u_n$ along increasing powers of $u$, and finally collect the resulting sequence of martingales polynomial in $(S_n,n)$. Let us see what happens in practice. Keeping only two terms in the expansion of $\ln\cosh(u)$ yields $\ln\cosh(u)=\frac12u^2-\frac1{12}u^4+O(u^6)$ hence $$ \exp(-(\ln\cosh(u))n)=1-\frac12u^2n+\frac1{12}u^4n+\frac18u^4n^2+O(u^6). $$ Multiplying this by $$ \exp(uS_n)=1+uS_n+\frac12u^2S_n^2+\frac16u^3S_n^3+\frac1{24}u^4S_n^4+\frac1{120}u^5S_n^5+O(u^6), $$ and looking for the coefficients of the powers of $u$ yields the martingales $$ 1,\ S_n,\ \frac12S_n^2-\frac12n,\ \frac16S_n^3-\frac12nS_n, $$ and $$ \frac1{24}S_n^4-\frac14nS_n^2+\frac1{12}n+\frac18n^2,\ \frac1{120}S_n^5-\frac1{12}nS_n^3+\frac18n^2S_n+\frac1{12}nS_n. $$ Thus, in $M_n^u$, $B_t$ scales like $1/u$ and $t$ like $1/u^2$ hence Hermite polynomials are homogeneous when one replaces $t$ by $B_t^2$. The analogues of Hermite polynomials for $(S_n,n)$, from degree $4$ on, are not homogenous in the sense of this dimensional analysis where $n$ is like $S_n^2$. Ultimately, this is simply because in $D_n^u$ one has to compensate $uS_n$ by $(\ln\cosh(u))n$, which is not homogenous in $u^2n$. Note that this argument of *non homogeneity* carries through to continuous time processes. For instance, the exponential martingales for the standard Poisson process $(N_t)_t$ are $$ \exp(uN_t-(\mathrm{e}^u-1)t), $$ and the rest of the argument is valid once noted that $\mathrm{e}^u-1$ is not a power of $u$.