The previous answer is focused more on defining a firm's place in the market than in setting goals. Setting goals is not the same thing as trying to decide what sorts of products to sell.
One type of goal is a strategic goal related to market standing. A firm might set a goal of capturing a certain amount of market share by a given date. The competition certainly has an impact on setting such goals. If there are many firms competing, all of which are well-established, your firm might need to set fairly low goals in terms of market share or in terms of absolute sales numbers.
Another type of strategic goal can relate to productivity. Of course, a firm always wants to improve productivity. However, if the competition is making major steps in that area, your firm may need to set more ambitious goals and try harder to be more productive.
In ways such as these, businesses must set goals with the competition in mind.
Competition and competitive market analysis are key aspects to setting business goals. Especially in the case of a small business, you need to define a market niche to be successful. That means thinking carefully about how you distinguish yourself from other businesses in your general market segment. For example, imagine if you were starting a shoe store in an upscale mall. If the mall already had a running shoe store and a very trendy high fashion shoe store, rather than open another shoe store in precisely those market segments, you might want to emphasize "upscale comfortable/classic business shoes" or "green/earth friendly shoes and handbags."