If you just have a grid of pixels - an "big field" on which pacman and ghost can move about freely - then the shortest path is easy - a straight line between the ghost and the pacman.
But "shortest path" invariably means we're trying to solve a graph-theory problem. (I'm assuming knowledge of graphs, some graph theory, adj. matrices, etc!)
In the case above, consider each pixel to be a node on a graph. Each node is connected to its neighbors by an edge, and each edge has equal "weight" (moving to the node on "above" is no slower than moving to the node "below").
So you have this: ("*" = node, "-, /, \, |" = edge)
*-*-*
|\|/|
*-*-* ... (etc)
|/|\|
*-*-*
If Pacman is in the center, it can move to any other node very easily.
Something more closer to reality might be this:
*-*-*
| | |
*-*-* ... (etc)
| | |
*-*-*
Now, pacman cannot move diagonally. To go from the center to the bottom-right requires 2 "hops" rather than one.
To continue the progression:
*-*-*-*
| | | |
| | | |
| | | |
*-*-*-*
| | | |
*-*-*-*
Now, to go from a node in the middle to a node at the top, you need 3 hops. However, to move toward the bottom only takes 1 hop.
It would be easy to translate any game-board setup into a graph. Each "intersection" is a node. The path between two intersections is an edge, and the length of that path is the weight of that edge.
Enter A*. By constructing a graph (use an adjency matrix or a list of nodes), you can use the A* algorithm to find the shortest path. Other algorithms include Dijkstra's. And many others! But first you need to frame your problem in terms of a graph, and then toy with how you'd go from node A (pacman) to node B (ghost).
Hope that helps!